/* Flash OS Routines (Automagically Generated)
 * Copyright (c) 2009-2015 ARM Limited
 */
#include "flash_blob.h"

static const uint32_t flash_code[] = {
    0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
    0x4770BA40, 0x4770BAC0, 0x0030EA4F, 0x00004770, 0x8F4FF3BF, 0xF64A4770, 0x49FE20AA, 0x10406008,
    0x20066008, 0x60081D09, 0x20AAF64A, 0x600849FA, 0x60081040, 0x1D092006, 0xF2406008, 0x49F710FF,
    0x207F6008, 0x60081F09, 0xB5104770, 0x460C4603, 0xF44FB672, 0x49F27080, 0x20076008, 0x600849F1,
    0x00DEF44F, 0xBF006148, 0x690048EE, 0x0004F000, 0xD1F92800, 0x68C048EB, 0x0001F000, 0x48EAB120,
    0x604849E8, 0x604848E9, 0x00DEF44F, 0x600849E8, 0x48E7BF00, 0x68001F00, 0x0004F000, 0xD1F82800,
    0x380848E3, 0xF0006800, 0xB1380001, 0x49E048DE, 0x60083910, 0x49DB48DD, 0x0104F8C1, 0xFFABF7FF,
    0x49D848DC, 0x49DA6148, 0x20006008, 0x4601BD10, 0x47702000, 0x49D348D8, 0xBF006148, 0x690048D1,
    0x0004F000, 0xD1F92800, 0x49D148D3, 0xBF006008, 0x1F0048CF, 0xF0006800, 0x28000004, 0xBF00D1F8,
    0x690048C8, 0x0004F000, 0xD1F92800, 0x68C048C5, 0x0030F020, 0x60C849C3, 0x68C04608, 0x0008F040,
    0x460860C8, 0xF04068C0, 0x60C80080, 0x48BDBF00, 0xF0006900, 0x28000004, 0x48BAD1F9, 0xF02068C0,
    0x49B80008, 0xBF0060C8, 0x1F0048B9, 0xF0006800, 0x28000004, 0x48B6D1F8, 0x68003808, 0x0030F020,
    0xF8C149B0, 0x4608010C, 0x010CF8D0, 0x0008F040, 0x010CF8C1, 0xF8D04608, 0xF040010C, 0xF8C10080,
    0xBF00010C, 0x1F0048AA, 0xF0006800, 0x28000004, 0x48A7D1F8, 0x68003808, 0x0008F020, 0xF8C149A1,
    0x2000010C, 0xB5704770, 0x461A4603, 0x3600F503, 0xE0922400, 0x4543F3C2, 0x6F00F1B2, 0xF1B2D33F,
    0xD23C6F01, 0x69404897, 0x310E499B, 0x49954308, 0xE0016148, 0xFF1FF7FF, 0x69004892, 0x0004F000,
    0xD1F72800, 0x68C0488F, 0x7130F647, 0x498D4388, 0xF04460C8, 0xEA400004, 0xF0402005, 0x68C90030,
    0x49884308, 0x460860C8, 0xF04068C0, 0x60C80080, 0xF7FFE001, 0x4883FF00, 0xF0006900, 0x28000004,
    0x4880D1F7, 0xF02068C0, 0x497E0004, 0x460860C8, 0xF0006900, 0x28000001, 0x2001D04C, 0x487CBD70,
    0x497D6800, 0x4308310E, 0xF8C14976, 0xE0010114, 0xFEE1F7FF, 0x1F004876, 0xF0006800, 0x28000004,
    0x4873D1F6, 0x68003808, 0x7130F647, 0x496D4388, 0x010CF8C1, 0x0104F044, 0x0008F1A5, 0x2000EA41,
    0x0030F040, 0xF8D14967, 0x4308110C, 0xF8C14965, 0x4608010C, 0x010CF8D0, 0x0080F040, 0x010CF8C1,
    0xF7FFE001, 0x4862FEB8, 0x68001F00, 0x0004F000, 0xD1F62800, 0x3808485E, 0xF0206800, 0x49590004,
    0x010CF8C1, 0x1F00485A, 0xF0006800, 0xB1080001, 0xE7B32001, 0x3200F502, 0x42B2BF00, 0xAF6AF67F,
    0xE7AB2000, 0x4DF7E92D, 0x46924605, 0x9C01462F, 0x46D0463A, 0xF1B72300, 0xD30A6F00, 0x6F01F1B7,
    0x4848D207, 0x494C6940, 0x4308310E, 0x61484945, 0x4847E007, 0x49486800, 0x4308310E, 0xF8C14941,
    0xE0AE0114, 0xFE77F7FF, 0x6F00F1B2, 0xF1B2D30A, 0xD2076F01, 0x68C0483B, 0x7130F647, 0x49394388,
    0xE00860C8, 0x3808483A, 0xF6476800, 0x43887130, 0xF8C14934, 0xF1B2010C, 0xD3066F00, 0x6F01F1B2,
    0x2032D203, 0x60C8492F, 0x2032E003, 0x39084930, 0x2C206008, 0x2300D30F, 0xF8D8E009, 0xF8D81000,
    0x60110004, 0xF1086050, 0x32080808, 0x2B041C5B, 0x3C20DBF3, 0x4616E015, 0x230046C3, 0xF81BE004,
    0xF8060B01, 0x1C5B0B01, 0xD3F842A3, 0xE0032300, 0xF80620FF, 0x1C5B0B01, 0x0020F1C4, 0xD8F74298,
    0xF7FF2400, 0xF1B2FE25, 0xD30C6F00, 0x6F01F1B2, 0xE001D209, 0xFE1FF7FF, 0x69004812, 0x0004F000,
    0xD1F72800, 0xE001E009, 0xFE15F7FF, 0x1F004810, 0xF0006800, 0x28000004, 0x480AD1F6, 0x20006900,
    0xF1B2B358, 0xD31E6F00, 0x6F01F1B2, 0x4805D21B, 0xE01368C0, 0x58004800, 0x58004C00, 0x40002C04,
    0x580244D4, 0x52002000, 0x45670123, 0xCDEF89AB, 0x52002114, 0x0FEE0000, 0x0FEF0000, 0x0002F020,
    0x60C84945, 0x4845E006, 0xF0206800, 0x49420002, 0x010CF8C1, 0xE8BD2000, 0xF1B28DFE, 0xD3096F00,
    0x6F01F1B2, 0x483CD206, 0xF02068C0, 0x493A0002, 0xE00660C8, 0x68004839, 0x0002F020, 0xF8C14936,
    0x2C00010C, 0xAF4EF47F, 0xE7E42000, 0x68004834, 0x0001F040, 0x60084932, 0x30104831, 0x49316800,
    0x492F4008, 0x60083110, 0x6800482D, 0x4008492E, 0x6008492B, 0x68004608, 0x2080F420, 0x48286008,
    0x68003010, 0x00FEF420, 0x31104925, 0x20006008, 0x31604923, 0x48226008, 0xF0206800, 0x49200018,
    0x481F6008, 0x68003010, 0x3110491D, 0x46086008, 0x60086800, 0x68004608, 0x7000F440, 0x05C86008,
    0x6008491A, 0xB5004770, 0xF7FF2200, 0x4812FD84, 0xE0016902, 0x69024810, 0x0001F002, 0xD1F92800,
    0x1D00480E, 0xE0026802, 0x1D00480C, 0xF0026802, 0x28000001, 0x4808D1F8, 0xE00168C2, 0x68C24806,
    0x28002000, 0x4805D1FA, 0xE0016802, 0x68024803, 0x28002000, 0xBD00D1FA, 0x52002000, 0x5200210C,
    0x58024400, 0xF87FC00C, 0xFEF6FFFF, 0xE000ED08, 0x00000000
};

const program_target_t flash_algo = {
    0x2000006B,  // Init
    0x200000EF,  // UnInit
    0x200000F5,  // EraseChip
    0x200001C7,  // EraseSector
    0x20000305,  // ProgramPage

    // BKPT : start of blob + 1
    // RSB  : address to access global/static data
    // RSP  : stack pointer
    {
        0x20000001,
        0x20000C00,
        0x20001000
    },

    0x20000400,  // mem buffer location
    0x20000000,  // location to write prog_blob in target RAM
    sizeof(flash_code),  // prog_blob size
    flash_code,  // address of prog_blob
    0x00000400,  // ram_to_flash_bytes_to_be_written
};